package com.aiyige.model.moment.backup;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.model.moment.entity.Content;
import com.aiyige.model.moment.entity.Guarantee;
import com.alibaba.fastjson.JSONArray;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;


/**
 * 功能: 图文说明（文章、图片和视频）和保障（按照列表查询时此项为空）. <br/>
 *
 * @author wangzhijun
 * @date 18/1/15 下午7:09
 * @since JDK 1.8
 */

public class DetailBackup implements Parcelable {
    /**
     * 图文详情（文章、图片和视频）
     */
    private List<Content> content;

    /**
     * 保障，保障的标题和内容的键值对映射
     */
    private List<Guarantee> guarantee;

    public List<Content> getContent() {
        return content;
    }

    public void setContent(List<Content> content) {
        this.content = content;
    }

    public List<Guarantee> getGuarantee() {
        return guarantee;
    }

    public void setGuarantee(List<Guarantee> guarantee) {
        this.guarantee = guarantee;
    }

    public DetailBackup() {
    }

    public DetailBackup(DetailBackup other) {
        if (other == null) {
            this.content = new LinkedList<>();
            this.guarantee = new LinkedList<>();
        } else {
            this.content = other.content == null ? new LinkedList<Content>() : other.content;
            this.guarantee = other.guarantee == null ? new LinkedList<Guarantee>() : other.guarantee;
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.content);
        dest.writeList(this.guarantee);
    }

    protected DetailBackup(Parcel in) {
        this.content = new ArrayList<Content>();
        in.readList(this.content, Content.class.getClassLoader());
        this.guarantee = new ArrayList<Guarantee>();
        in.readList(this.guarantee, Guarantee.class.getClassLoader());
    }

    public static final Creator<DetailBackup> CREATOR = new Creator<DetailBackup>() {
        @Override
        public DetailBackup createFromParcel(Parcel source) {
            return new DetailBackup(source);
        }

        @Override
        public DetailBackup[] newArray(int size) {
            return new DetailBackup[size];
        }
    };
}
